package Object;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

interface Shape{
    double getArea();
    double getPerimeter();
}
interface TwoDimensionalShape{
    double getArea();

    double getPerimeter();

    double getWidth();
    double getHeight();
}
interface ThreeDimensionalShape extends Shape{
    double getVolume();
}
class Circle implements TwoDimensionalShape{
    private final double radius;

    public Circle(double radius){
        this.radius = radius;
    }

    @Override
    public double getArea() {
        return Math.PI*radius*radius;
    }

    @Override
    public double getPerimeter() {
        return 2*Math.PI*radius;
    }
    @Override
    public double getWidth() {
        return 2*radius;
    }

    @Override
    public double getHeight() {
        return 2*radius;
    }

}
class Rectangle implements TwoDimensionalShape{
    private double width;
    private double height;
    public Rectangle(double width,double height){
        this.width = width;
        this.height = height;
    }
    @Override
    public double getArea() {
        return width*height;
    }

    @Override
    public double getPerimeter() {
        return 2*(width+height);
    }

    @Override
    public double getWidth() {
        return width;
    }

    @Override
    public double getHeight() {
        return height;
    }
}
class Sphere implements ThreeDimensionalShape{
    private double radius;
    public Sphere(double radius){
        this.radius = radius;
    }
    @Override
    public double getVolume() {
        return 4.0/3.0*Math.PI*radius*radius;
    }

    @Override
    public double getArea() {
        return 4*Math.PI*radius*radius;
    }

    @Override
    public double getPerimeter() {
        return Double.NaN;
    }
}
public class Main {
    public static void main(String[] args) {
        Circle circle = new Circle(5);
        System.out.println("Circle area:"+circle.getArea());
        System.out.println("Circle perimeter:"+circle.getPerimeter());

        Rectangle rectangle = new Rectangle(3,4);
        System.out.println("Sphere area:"+rectangle.getArea());
        System.out.println("Sphere perimeter:"+rectangle.getPerimeter());

        Sphere sphere = new Sphere(2);
        System.out.println("Sphere area:"+sphere.getArea());
        System.out.println("Sphere volume:"+sphere.getVolume());
        String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        System.out.println(time);
    }
}
